﻿//
// This file is part of AVSReflector project
// Copyright (C) 2011 Yuan Pengfei
//

using System;
using System.Collections.Generic;
using System.Text;

namespace AVSReflector.Core
{
    public class CopyrightExtension : INode
    {
        public uint copyright_flag;
        public uint copyright_id;
        public uint original_or_copy;
        public uint copyright_number_1;
        public uint copyright_number_2;
        public uint copyright_number_3;

        public string[] GetInfo()
        {
            List<string> lines = new List<string>();
            lines.Add("copyright_flag = " + copyright_flag);
            lines.Add("copyright_id = " + copyright_id);
            lines.Add("original_or_copy = " + original_or_copy);
            lines.Add("copyright_number_1 = " + copyright_number_1);
            lines.Add("copyright_number_2 = " + copyright_number_2);
            lines.Add("copyright_number_3 = " + copyright_number_3);
            return lines.ToArray();
        }

        public static CopyrightExtension Parse(BitStream s)
        {
            CopyrightExtension ret = new CopyrightExtension();
            ret.copyright_flag = s.Read(1);
            ret.copyright_id = s.Read(8);
            ret.original_or_copy = s.Read(1);
            s.Read(8);
            ret.copyright_number_1 = s.Read(20);
            s.Read(1);
            ret.copyright_number_2 = s.Read(22);
            s.Read(1);
            ret.copyright_number_3 = s.Read(22);
            s.SkipToCode(0x1, 24);
            return ret;
        }
    }
}
